package com.example.leetdemo.finash;

public class Solution2696 {

    public int minLength(String s) {
        while(s.contains("AB") || s.contains("CD")) {
            s = s.replaceAll("AB", "");
            s = s.replaceAll("CD", "");
        }
        return s.length();
    }

    // 存一个stack栈 只入AB当
}
